package com.bdqn.ch07SL.mapper.impl;

import com.bdqn.ch07SL.SysUser;
import com.bdqn.ch07SL.mapper.SysUserMapper;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class SysUserMapperImpl extends SqlSessionDaoSupport implements SysUserMapper {
    private SqlSessionTemplate sqlSession;

    // 查询用户列表
    @Override
    public List<SysUser> selectSysUserList(SysUser sysUser) {
//        return sqlSession.selectList("com.bdqn.ch07SL.mapper.SysUserMapper.selectSysUserList", sysUser);
        // 简化SqlSessionTemplate的配置和获取方式
        return this.getSqlSession().selectList("com.bdqn.ch07SL.mapper.SysUserMapper.selectSysUserList", sysUser);
    }

    public SqlSessionTemplate getSqlSession() {
        return sqlSession;
    }

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }
}
